<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>斐波那契数列递归调用</title>
  </head>

  <body>

  </body>
  <title>斐波那契数列递归调用</title>
  <script>
    function f(n) {
      if (n === 1) {
        return 0
      } else if (n === 2) {
        return 1;
      } else {
        return f(n - 1) + f(n - 2);
      }
    }
    console.log(f(6)); //5
  </script>

</html>